package LeetCode.leetcode;

/**
 * 回文数
 * @author: leiwenkang02@meituan.com
 * @date: 2018/9/11
 * @time: 18:52
 */
public class Test09回文数 {
    public boolean isPalindrome(int x) {
        if (x < 0 || x != 0 && x % 10 == 0) {
            return false;
        }
        int rev = 0;
        while (x > rev) {
            rev = rev * 10 + x % 10;
            x = x / 10;
        }
        return x == rev || x == rev / 10;
    }
}
